<{capture name="body"}>
  <{$_PAGE_}>
<{/capture}>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><{$title}></title>
<link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<{if defined('DEBUG_CSS') && DEBUG_CSS}>
<{css src="framework.css" app="desktop"}>
<{css src="default/style.css" app="desktop"}>
<{css src="default/singlepage.css" app="desktop"}>
<{else}>
<{css src="default/style_min.css" app="desktop"}>
<{css src="default/singlepage_min.css" app="desktop"}>
<{/if}>
<!-- 引进app的singlepage页面自定义css-@lujy -->
<{$singleappcss}>
<{lang_css src="lang.css" app="desktop"}>
<{lang_script src="lang.js" app='desktop'}>
<{script src="loader.js" app="desktop"}>

<{if defined('DEBUG_JS') && DEBUG_JS}>
  <{script src="moo.js" app="desktop"}>
  <{script src="moomore.js" app="desktop"}>
  <{script src="mooadapter.js" app="desktop"}>
  <{script src="jstools.js" app="desktop"}>

  <{script src="coms/messagebox.js" app="desktop"}>
  <{script src="coms/validate.js" app="desktop"}>
  <{script src="coms/wpage.js" app="desktop"}>
  <{script src="coms/dialog.js" app="desktop"}>
  <{script src="coms/dropmenu.js" app="desktop"}>
<{else}>
  <{script src="moo_min.js" app="desktop" pdir="js_mini"}>
  <{script src="tools_min.js" app="desktop" pdir="js_mini"}>
<{/if}>


<script>

(function(){
  <{if defined('DEBUG_JS') && DEBUG_JS}>
    var js_path='<{$desktop_path}>/js/';
    var timer = '?<{$smarty.now}>';
  <{else}>
    var js_path='<{$desktop_path}>/js_mini/';
    var timer = '';
  <{/if}>

    var hs = {
        'cmdrunner':{path:js_path+'coms/cmdrunner.js'+timer,type:'js'},
        'historyMan':{path:js_path+'coms/hst.js'+timer,type:'js'},
        'autocompleter':{path:js_path+'coms/autocompleter.js'+timer,type:'js'},
        'uploader':{path:js_path+'coms/uploader.js'+timer,type:'js'},
        'modedialog':{path:js_path+'coms/modedialog.js'+timer,type:'js'},
        'finder':{path:js_path+'coms/finder.js'+timer,type:'js'},
        'pager':{path:js_path+'coms/pager.js'+timer,type:'js'},
        <{if defined('DEBUG_JS') && DEBUG_JS}>
        'colorpicker':{path:js_path+'coms/colorpicker.js'+timer,type:'js'},
        'editor_style_1':{path:js_path+'coms/editor_style_1.js'+timer,type:'js',requires:['picker']},
        <{/if}>
        'picker':{path:js_path+'coms/datapicker.js'+timer,type:'js',requires:['colorpicker']},
        'editor':{path:js_path+'coms/editor.js'+timer,type:'js',requires:['editor_style_1']}
    };
    Object.each(hs,function(v,k){Ex_Loader.add(k,v);});
})();

var startTime = (new Date).getTime();
var SHOPADMINDIR='<{$shopadmin_dir}>';
var SHOPBASE='<{$shop_base}>';
var DESKTOPRESURL='<{$desktopresurl}>';
var DESKTOPRESFULLURL='<{$desktopresfullurl}>';
var DEBUG_JS=false;
var Setting = {};
var Menus = "json from=$mlist";
var sess_id = '<{$session_id}>';
var BREADCRUMBS ='0:0';
<{$script}>
<{if $statusId}>
window.statusId = <{$statusId}>;
<{/if}>
window.loadedPart = [1,0,startTime];

</script>

<{$env.capture.header}>
<{desktop_header}>
</head>
<body class="single-page <{if $env.capture.sidebar}>single-page-col2<{/if}>">
<noscript>
  <div class='noscript error'>
     <{t}>您好，要正常运行ECStore后台，浏览器必须支持Javascript<{/t}>
  </div>
</noscript>
<div style="display:none;">
  <iframe src='<{$env.base_url}>/app/desktop/view/tpl.html' id='tplframe' tabindex=-1></iframe>
  <iframe src='<{$env.base_url}>/app/desktop/view/about.html' name='download' tabindex=-2  id='downloadframe'></iframe>
  <iframe src='<{$env.base_url}>/app/desktop/view/about.html' name='upload' tabindex=-2  id='uploadframe'></iframe>
</div>

<div class='msgbox' id='messagebox'></div>
<div class='wrapper body' id='body'>
  <div class="aside" id="aside"></div>
  <div class='container clearfix' id='container'>
    <div class='side span-auto side-close' id='side' <{if !$env.capture.sidebar}>style="display:none;"<{/if}>>
      <div class='side-menu mlist' id="menu-desktop">
      <{$env.capture.sidebar}>
      </div>
    </div>
    <div class='workground' id='workground'>
      <div class="toggler-left flt hide" id='leftToggler'>
        <div class="toggler-left-inner">&nbsp;</div>
      </div>
      <div class='content-head' style="<{if !$env.capture.headbar}>height:0;<{/if}>"><{$env.capture.headbar}></div>
      <div class='content-main' id='main'>
      <{$env.capture.body}>
      </div>
      <div class='content-foot' style="<{if !$env.capture.footbar}>height:0;<{/if}>"><{$env.capture.footbar}></div>
    </div>
    <div class="side-r hide" id="side-r">
      <div class="side-r-resize" id="side-r-resize">&nbsp;</div>
      <div class="side-r-top content-padded clearfix">
        <div class="side-r-title flt f-14"></div>
        <span class="frt side-r-close pointer"><i class="icon fa fa-times"></i></span>
      </div>
      <div class="side-r-head" style="border-bottom:1px #999 solid;padding:2px 0 2px 0;font-size:0;height:0;"></div>
      <div id="side-r-content" class="side-r-content" conatainer="true" style="overflow:auto"></div>
      <div class="side-r-foot" style="font-size:0;height:0;"></div>
    </div>
  </div>
</div>

<script hold="true">
var LAYOUT = {
    aside: $('aside'),
    container: $('container'),
    side: $('side'),
    workground: $('workground'),
    content_main: $('main'),
    content_head: $E('#workground .content-head'),
    content_foot: $E('#workground .content-foot'),
    side_r: $('side-r'),
    side_r_content:$('side-r-content')
};

var initDefaultPart = function(){
    //fixSideLeft = $empty;
    window.resizeLayout = fixLayout = fixSideLeft = function(){

        var winSize = window.getSize();
        var _NUM = function(num){
           num = isNaN(num)?0:num;
           if(num<0)num=0;
           return num;
        }

        var containerHeight = winSize.y;
        var mw=0,mh=0;

        LAYOUT.container.setStyle('height',_NUM(containerHeight-LAYOUT.container.getPatch().y));
        LAYOUT.container.setStyle('width',_NUM(winSize.x.limit(960, 2000)));


        if(!LAYOUT.side.hasClass('hide')){
          LAYOUT.side.setStyle('width',_NUM( (winSize.x * 0.12).limit(150,winSize.x)));
        }

        LAYOUT.workground.setStyle('width',_NUM(
          winSize.x
          -LAYOUT.side.getSize().x
          -LAYOUT.side_r.getSize().x)
        ).setStyle('left',LAYOUT.side.offsetWidth);

        LAYOUT.content_main.setStyles({'height':
            (mh=_NUM(containerHeight -
            LAYOUT.content_head.getSize().y  -
            LAYOUT.content_foot.getSize().y -
            LAYOUT.workground.getPatch().y + 20
            )),
            'width':(mw=_NUM(LAYOUT.workground.getSize().x-LAYOUT.workground.getPatch().x))
          }).fireEvent('resizelayout',[mw,mh]);

        if(!LAYOUT.side_r.hasClass('hide')){
            if(!LAYOUT.side_r.get('widthset'))
                LAYOUT.side_r.setStyle('width',_NUM((winSize.x*0.15).limit(150,winSize.x)));
          LAYOUT.side_r_content.setStyle('height',_NUM(
            containerHeight
          -LAYOUT.side_r.getElement('.side-r-top').getSize().y
          -LAYOUT.side_r.getElement('.side-r-head').getSize().y
          -LAYOUT.side_r.getElement('.side-r-foot').getSize().y
          -LAYOUT.side_r_content.getPatch().y-LAYOUT.side_r.getPatch().y));
          LAYOUT.side_r.setStyle('left',winSize.x - LAYOUT.side_r.offsetWidth);
        }
    };

    /*MODAL PANEL*/
    MODALPANEL = {
      createModalPanel:function(){
        var mp = new Element('div',{'id':'MODALPANEL'});
            var mpStyles = {
                'position': 'absolute',
                'background': '#333333',
                'width': '100%',
                'display':'none',
                'height': window.getScrollSize().y,
                'top': 0,
                'left': 0,
                'zIndex': 65500,
                'opacity': .4
            };
        this.element = mp.setStyles(mpStyles).inject(document.body);
        return this.element;
      },
      show:function(){
        var panel = this.element = this.element||this.createModalPanel();
        panel.setStyles({
          'width': '100%',
                  'height': window.getScrollSize().y
        }).show();
      },hide:function(){
        if(this.element)this.element.hide();
      }
    };





      var windowResizeTimer = 0;
      window.addEvent('resize',function(){
       $clear(windowResizeTimer);
       windowResizeTimer = window.resizeLayout.delay(200);

       if(MODALPANEL.element&&MODALPANEL.element.style.display!='none'){
            MODALPANEL.element.setStyles({
                 'height':window.getScrollSize().y
            });
        }
       }).fireEvent('resize');

       EventsRemote = new Request({url:'index.php?ctl=default&act=desktop_events'});


           W = new Wpage({update:document.body,'singlepage':true});
           W.render(document.body);
       W.onComplete();
       Xtip = new Tips({tip:'tip_Xtip',fixed:true,offset: {x: 24, y: -15},onBound:function(bound){
              if(bound.x2){
                  this.tip.getElement('.tip-top').addClass('tip-top-right');
                  this.tip.getElement('.tip-bottom').addClass('tip-bottom-right');
              }else {
                  this.tip.getElement('.tip-top').removeClass('tip-top-right');
                  this.tip.getElement('.tip-bottom').removeClass('tip-bottom-right');
              }
           }});


    Side_R = new Class({
        Implements: [Options, Events],
        options: {

            onShow: $empty,
            onHide: $empty,
            onReady: $empty,
        isClear:true,
        width:false

        },
        initialize: function(url, opts) {
            this.setOptions(opts);
            this.panel = $('side-r');
            this.container = $('side-r-content');
        var trigger = this.options.trigger;

        if(trigger&&!trigger.retrieve('events',{})['dispose']){
                    trigger.addEvent('dispose',function(){

                 $('side-r').addClass('hide');
                 $('side-r-content').empty();
                 $('side-r').removeProperty('widthset').store('url','');

              });
        }

        if(this.panel.retrieve('url','') == url)return;

        if (url) {
                this.showSide(url);
            } else {
                throw Exception('NO TARGET URL');
                return;
            }

           var btn_close = this.panel.getElement('.side-r-close');
         var _title = this.panel.getElement('.side-r-title');

           _title.set('text',this.options.title||"")

          if(btn_close){
                  btn_close.removeEvents('click').addEvent('click', this.hideSide.bind(this));
              }

        },
        showSide: function(url) {
            this.cleanContainer();

            var _this = this;
        if(_this.options.width&&!_this.panel.get('widthset')){
            _this.panel.set({'widthset':_this.options.width,styles:{width:_this.options.width}});
         }
        _this.panel.removeClass('hide');
         _this.fireEvent('show');
        window.resizeLayout();

        if(this.cache)return;
              W.page(url,{
                  update:_this.container,
            render:false,
                  onRequest: function() {
                      _this.panel.addClass('loading');
                  },

                  onComplete: function() {
                      _this.panel.removeClass('loading');
                      _this.fireEvent('ready', $splat(arguments));
                      _this.panel.store('url',url);
            _this.container.style.height = (_this.container.style.height.toInt()-_this.container.getPrevious().getSize().y-_this.container.getNext().getSize().y)+'px';
                  }
              });

        },
        hideSide: function() {

            this.panel.addClass('hide');
            window.resizeLayout();
            this.cleanContainer();
            this.fireEvent('hide');

        },
        cleanContainer: function() {
            this.panel.store('url','');
            if(this.options.isClear)this.container.empty();
        }

    });

    new Drag($('side-r-resize'), {
      modifiers: {
        'x': 'left',
        'y':false
      },
      onBefore:function(el){
        el.addClass('side-r-resize-ing');
      },
      onDrag: function(el) {

        el.addClass('side-r-resize-ing');

      },
      onComplete: function(el) {
        el.removeClass('side-r-resize-ing');

        var left = el.getStyle('left');
          left = left.toInt();
        var _w =  LAYOUT.side_r.style.width.toInt()-(left-(-5));
        LAYOUT.side_r.style.width = _w+'px';
        LAYOUT.side_r.set('widthset',_w);
        el.style.left = '-5px';
        resizeLayout();
      }
    });

    $exec($("__eval_scripts__").get("html"));
   };

  window.addEvent('domready',initDefaultPart);
</script>
<{desktop_footer}>
</body>
</html>
